From cd0570b8945132ee01a2247cf51e4bf1fd359c3d Mon Sep 17 00:00:00 2001 From: Rob Church Date: Sun, 3 Dec 2006 04:09:48 +0000 Subject: [PATCH] Quote namespace names before plonking them into a regular expression, to give me the warm fuzzies --- includes/Linker.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/Linker.php b/includes/Linker.php index b54c4264a7..f7b5c0aed3 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -931,8 +931,8 @@ class Linker { # format regular and media links - all other wiki formatting # is ignored - $medians = '(?:' . Namespace::getCanonicalName( NS_MEDIA ) . '|'; - $medians .= $wgContLang->getNsText( NS_MEDIA ) . '):'; + $medians = '(?:' . preg_quote( Namespace::getCanonicalName( NS_MEDIA ), '/' ) . '|'; + $medians .= preg_quote( $wgContLang->getNsText( NS_MEDIA ), '/' ) . '):'; while(preg_match('/\[\[(.*?)(\|(.*?))*\]\](.*)$/',$comment,$match)) { # Handle link renaming [[foo|text]] will show link as "text" if( "" != $match[3] ) { -- 2.20.1